package com.mowh.gof23.behavioral.patterns.interpreter;

import java.io.BufferedReader;
import java.io.FileReader;

/**
 * @author mowh1gd
 * @create 2023/10/27 12:57
 */
public class Main {
    public static void main(String[] args) {
        try {
            BufferedReader reader = new BufferedReader(new FileReader(Main.class.getClassLoader().getResource("interpreter/program.txt").getPath()));
            String text;
            while ((text = reader.readLine()) != null) {
                System.out.println("text = \"" + text + "\"");
                Node node = new ProgramNode();
                node.parse(new Context(text));
                System.out.println("node = " + node);
            }
            reader.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
